﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DC2010;

namespace DC2010_EditorInfo
{
    public partial class GfxPlacementUC : UserControl
    {
        public int X { get; set; }
        public int Y { get; set; }
        public string Path { get; set; }
        public int Scl { get; set; }

        public int posX { get; set; }
        public int posY { get; set; }


        public GfxPlacementUC()
        {
            InitializeComponent();
        }

        public void Init(int x, int y, int posX, int posY, string path, int scale)
        {
            X = x;
            Y = y;
            this.posX = posX;
            this.posY = posY;
            Path = path;
            Scl = scale;

            textBox6.Text = path;
            textBox1.Text = scale.ToString();

            textBox14.Text = posX.ToString();
            textBox15.Text = posY.ToString();

            label8.Text = string.Format("{0}, {1}", X, Y);

        }

        public void Init(int X, int Y, InGameObjectPosition igop)
        {
            Init(X, Y, igop.X, igop.Y, igop.Texture, igop.Scale);
        }

        private void crystalButton3_Click(object sender, EventArgs e)
        {
            Path = textBox6.Text;
            posX = textBox14.Text.ToInt();
            posY = textBox15.Text.ToInt();
            Scl = textBox1.Text.ToInt();

            GfxPlacementHelpDialog gfxpd = new GfxPlacementHelpDialog(X, Y, posX, posY, Path, Scl);
            gfxpd.ShowDialog();

            posX = gfxpd.PosX;
            posY = gfxpd.PosY;
            Path = gfxpd.Pth;
            Scl = gfxpd.Scl;


            textBox6.Text = Path;
            textBox14.Text = posX.ToString();
            textBox15.Text = posY.ToString();
            textBox1.Text = Scl.ToString();
        }

        private void textBox6_TextChanged(object sender, EventArgs e)
        {
            try
            {
                //Path = textBox6.Text;
                //posX = textBox14.Text.ToInt();
                //posY = textBox15.Text.ToInt();
                //Scl = textBox1.Text.ToInt();
            }
            catch (Exception ex)
            {
                int a = 9;
            }
        }
    }
}
